home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / ubiquity / migration-assistant / ma-apply next >
Text File  |  2008-05-01  |  2KB  |  75 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4. . /usr/share/debconf/confmodule
  5. . /usr/share/migration-assistant/ma-script-utils
  6. OLDIFS="$IFS"
  7. NEWLINE='
  8. '
  9.  
  10. if [ -z "$1" ]; then
  11.     mapath="/usr/bin"
  12. else
  13.     mapath="$1"
  14. fi
  15.  
  16.  
  17. db_get migration-assistant/partitions || exit 10
  18. IFS="$NEWLINE"
  19. selection=`echo "$RET" | sed -e 's/, /\n/g'`
  20. for choice in $selection; do # Microsoft Windows XP Professional (/dev/hda1)
  21.     IFS="$OLDIFS"
  22.     location=$(LC_ALL=C expr "$choice" : '.*(\(.*\))') # /dev/hda1
  23.     IFS="$NEWLINE"
  24.     for line in `os-prober`; do
  25.         IFS="$OLDIFS"
  26.         loc="${line%%:*}"
  27.         if [ "$location" != "$loc" ]; then
  28.             continue
  29.         fi
  30.         set_os_type "$line" || continue
  31.         path=${loc#*/*/}
  32.         mount_os "$ostype" "$loc"
  33.         db_get migration-assistant/$path/users || continue
  34.         IFS="$NEWLINE"
  35.         user_selection=`echo "$RET" | sed -e 's/, /\n/g'`
  36.         for usr in $user_selection; do
  37.             IFS="$OLDIFS"
  38.             formatted_user=`echo "$usr" | sed -e 's/ /+/g' | sed -e 's/,+/, /g'`
  39.             db_get migration-assistant/$path/$formatted_user/user || continue
  40.             new_user=$RET
  41.  
  42.             if [ $(grep -c ^$new_user: $ROOT/etc/passwd) -eq 0 ]; then
  43.                 log "creating user $new_user"
  44.                 db_get migration-assistant/new-user/$new_user/password || continue
  45.                 pass=$RET
  46.                 db_get migration-assistant/new-user/$new_user/fullname || continue
  47.                 fn=$RET
  48.                 add_user "$new_user" "$fn" "$pass"
  49.             fi
  50.             
  51.             db_get migration-assistant/$path/$formatted_user/items || continue
  52.             log "importing: $RET"
  53.             IFS="$NEWLINE"
  54.             item_selection=`echo "$RET" | sed -e 's/, /\n/g'`
  55.             for itm in $item_selection; do
  56.                 IFS="$OLDIFS"
  57.                 itm=$(echo $itm | sed -e 's/ //g' | tr [A-Z] [a-z])
  58.                 log-output -t migration-assistant $mapath/ma-import \
  59.                 --target="$itm" \
  60.                 --ostype="$ostype" \
  61.                 --fromuser="$usr" \
  62.                 --frompath="$mountpoint" \
  63.                 --touser="$new_user" \
  64.                 --topath="$ROOT" \
  65.                 || error "importing $itm failed."
  66.                 IFS="$NEWLINE"
  67.             done
  68.             IFS="$NEWLINE"
  69.         done
  70.         IFS="$OLDIFS"
  71.         unmount_os
  72.         IFS="$NEWLINE"
  73.     done
  74. done
  75.